# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=sed
pkgver=4.2.2
pkgrel=2
pkgdesc="GNU stream editor"
arch=('i686' 'x86_64')
url="http://www.gnu.org/software/sed"
license=('GPL3')
groups=('base' 'base-devel')
depends=('libintl' 'sh')
makedepends=('gettext' 'gettext-devel')
install=sed.install
source=(ftp://ftp.gnu.org/pub/gnu/sed/${pkgname}-${pkgver}.tar.gz{,.sig}
        sed-4.2.2-3.src.patch
        sed-4.2.2-msys2.patch)
md5sums=('4111de4faa3b9848a0686b2f260c5056'
         'SKIP'
         '7ed7a127ffdf98272a729cf7a080e0c1'
         'd8872e5cedba1fa121278af6be4763ad')

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}

  patch -p2 -i ${srcdir}/sed-4.2.2-3.src.patch
  patch -p1 -i ${srcdir}/sed-4.2.2-msys2.patch

  autoreconf -fi
}

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  ./configure --prefix=/usr --build=${CHOST}
  make all html
}

check() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make check
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install
  cd doc
  make DESTDIR=${pkgdir} install-html
}
